<%@ page language="java" contentType="text/html; charset=UTF-8"
	pageEncoding="UTF-8"%>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
<%@ taglib prefix="u" uri="/iuie-tag"%>
<%@ taglib prefix="sys" uri="/sys-tag"%>
<%@ taglib prefix="lui" tagdir="/WEB-INF/tags"%>

<!DOCTYPE html>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<title>添加书籍</title>
</head>
<lui:context />
<u:View basePath="/res-datum/book" userJS="bookAdd" userCSS="bookAdd"
	delayLoadJs="false">
	<body>
		<lui:dialogBody>
			<sys:dropCodeSet codeTypes="bookTypes,bookProgress" id="codeSet" />
			<form class="m-cust" method="post"
				action="${ctx}/datum/file/doUpload" enctype="multipart/form-data"
				target="uploadIFrm" id='uploadArticle'>
				<iframe id="uploadIFrm" name="uploadIFrm" style="display: none;"></iframe>
				<div class="form-group m-narrow row" style='margin-left: 0;'>
					<div class="col-xs-10">
						<label class="m-btn m-primary m-round-btn" for="xFile">上传文件</label>
						<input class='m-file' type="file" id="xFile" name='file' onchange="BookAddPage.onFileChanged(this)">
						<button type="submit" class="m-btn m-color-charcoal-grey m-round-btn t-tag">
							<i class='fa fa-upload'></i>提交
						</button>
					</div>
				</div>
				<input type="hidden" name='immediately' value='false'> 
				<input type="hidden" name='fileType' value='book'> 
				<input type="hidden" name='func' value='parent.BookAddPage.onUploadSucc'>
			</form>
			<form class="m-cust" method="post"
				action="${ctx}/datum/file/doUpload" enctype="multipart/form-data"
				target="uploadImageIFrm" id='uploadBookImage' >
				<iframe id="uploadImageIFrm" name="uploadImageIFrm" style="display: none;"></iframe>
				<div class="form-group m-narrow row" style='margin-left: 0;'>
					<div class="col-xs-10">
						<label class="m-btn m-primary m-round-btn" for="imageFile">上传书籍封面</label>
						<input class='m-file' type="file" id="imageFile" name='file' onchange="BookAddPage.showImg(this)">
						<button type="submit" class="m-btn m-color-charcoal-grey m-round-btn t-tag">
							<i class='fa fa-upload'></i>提交
						</button>
						<span><img id="thumburlShow" src="" width="120" height="120" style="display:none"/></span>
					</div>
				</div>
				<input type="hidden" name='immediately' value='false'> 
				<input type="hidden" name='fileType' value='book'> 
				<input type="hidden" name='func' value='parent.BookAddPage.onUploadImageSucc'>
			</form>
			<form class="m-cust" id="addBlogFrm">
				<lui:ajax url="${ctx }/book/saveBook" id="addBlogAjax"
					formQuery="#addBlogFrm" type="post" formSubmit="true"
					contentType="application/x-www-form-urlencoded" onSuccess="BookAddPage.onAddBlogSucc"/>
				<div class="form-group m-narrow row">
					<div class="col-xs-12">
						<div class="col-xs-2">
							<label class="m-label required" for="bookName">标题：</label>
						</div>
						<div class="col-xs-8">
							<input name="bookName" autofocus="autofocus" id="bookName"
								class="form-control m-input" data-validate='true'
								data-not-empty='true' data-empty-text="标题不能为空" maxlength="100">
						</div>
					</div>
				</div>
				<div class="form-group m-narrow row">
					<div class="col-xs-12">
						<div class="col-xs-2">
							<label class="m-label" for="bookType">书籍类型：</label>
						</div>
						<div class="col-xs-8">
							<lui:dropList id="bookType" name="bookType"
								dropValues="codeSet.bookTypes"
								className="form-control m-input" />
						</div>
					</div>
				</div>
				<div class="form-group m-narrow row">
					<div class="col-xs-12">
						<div class="col-xs-2">
							<label class="m-label" for="progress">状态：</label>
						</div>
						<div class="col-xs-8">
							<lui:dropList id="progress" name="progress"
								dropValues="codeSet.bookProgress"
								className="form-control m-input" />
						</div>
					</div>
				</div>
				<div class="form-group m-narrow row">
					<div class="col-xs-12">
						<div class="col-xs-2">
							<label class="m-label" for="authorName">作者：</label>
						</div>
						<div class="col-xs-8">
							<input name="authorName" autofocus="autofocus" id="authorName"
								class="form-control m-input" data-validate='true'
								maxlength="100">
						</div>
					</div>
				</div>
				<div class="form-group m-narrow row">
					<div class="col-xs-12">
						<div class="col-xs-2">
							<label class="m-label" for="comments">概述：</label>
						</div>
						<div class="col-xs-8">
							<textarea class='form-control m-input' id='comments' cols="45"
								rows="4" name='comments'></textarea>
						</div>
					</div>
				</div>
				
				<input type='hidden' name='urlFileId' id='fileId'>
				<input type="hidden" name="coverFileId" id="coverFileId"> 
				<input type='hidden' name='blogId'> 
				<input type="hidden" name='blogAttr' value='0'>
			</form>

		</lui:dialogBody>
		<lui:dialogFooter>
			<button class="btn btn-primary m-btn" type="button" onclick="BookAddPage.saveBook()">保存</button>
			<button class="btn btn-default m-btn" type="button" data-dismiss="dialog-box">关闭</button>
		</lui:dialogFooter>
	</body>
</u:View>
</html>